from django.db import models
import spot_settings.models


class ScoutGroupHistory(models.Model):
    status = models.ForeignKey(spot_settings.models.ListOptions, related_name='scoutgrouphistory_status')
    fromDate = models.DateTimeField()
    toDate = models.DateTimeField()


class ScoutGroups(models.Model):
    groupType = models.ForeignKey(spot_settings.models.ListOptions, related_name='scoutgroups_group_type')
    code = models.CharField(max_length=20)
    groupName = models.CharField(max_length=200)

    status = models.ForeignKey(spot_settings.models.ListOptions, related_name='scoutgroups_status')
    #XML!
    groupInformation = models.CharField(max_length=1000)
    groupsHistory = models.ManyToManyField(ScoutGroupHistory)

#class Contacts(models.Model):
#    contactType = models.ForeignKey(spot_settings.models.ListOptions, related_name='contacts_contact_type')
    #XML!
#    contactInformation = models.CharField(max_length=1000)


class Person(models.Model):
    participationType = models.ForeignKey(spot_settings.models.ListOptions, related_name='person_participation_type')

    name = models.CharField(max_length=100)
    surname = models.CharField(max_length=100)
    familyName = models.CharField(max_length=100)

    pid = models.CharField(max_length=10)
    gender = models.ForeignKey(spot_settings.models.ListOptions, related_name='person_gender')
    age = models.IntegerField()
    status = models.ForeignKey(spot_settings.models.ListOptions, related_name='person_status')

    #contacts = models.ManyToManyField(Contacts)
    parents = models.ManyToManyField('self')
    scout_pid = models.CharField(max_length=20)
    scout_groups = models.ManyToManyField(ScoutGroups)


class OptionLists(models.Model):
    parentList = models.ForeignKey('self')
    name = models.CharField(max_length=200)
    code = models.CharField(max_length=20)
    create_date = models.DateTimeField('Date of creation')
    update_date = models.DateTimeField('Date of last update')


class ListOptions(models.Model):
    optionList = models.ForeignKey(OptionLists)
    parentOption = models.ForeignKey('self')
    name = models.CharField(max_length=200)
    code = models.CharField(max_length=20)
    create_date = models.DateTimeField('Date of creation')
    update_date = models.DateTimeField('Date of last update')
